#include <iostream>
#include <string>

//this：c++编译器提供给类的指向本对象的指针
// this-> 取当前对象的属性行为
// *this:当前对象
class Student
{
public:
    Student(int id,const char *name)//带参构造
    {
        std::cout<<"带参构造函数"<<std::endl;
        this->id = id;
        this->name = name;
    }
     Student(const Student& t)//带参构造
    {
        std::cout<<"拷贝构造函数"<<std::endl;
    }
    Student& GetObj()
    {
        return *this;//取当前对象
    }

private:
    int id;  //成员变量
    std::string name;

};

int main()
{

    Student t(1,"zhangsan");
    Student t1 = t.GetObj();
    return 0;
}